package com.tuling.event;

import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class OrderEventListener implements ApplicationListener<OrderEvent> {

	//@Override
	//@EventListener(OrderEvent.class)
	public void onApplicationEvent(OrderEvent event) {
		if ("减库存".equals(event.getName())) {
			try {
				TimeUnit.SECONDS.sleep(1);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println("减库存......");
		}
	}
}
